#!/bin/bash

# run matplotlib once to generate the font cache
python -c "import matplotlib as mpl; mpl.use('Agg'); import matplotlib.pyplot as plt; fig, ax = plt.subplots(); fig.savefig('test.png')"

test -e test.png && rm test.png

# create default ipython profile
ipython profile create
IPYTHON_KERNEL_CONFIG="${REPO_DIR}/.ipython/profile_default/ipython_kernel_config.py"

# add EnergyFlow specific config
cat $IPYTHON_KERNEL_CONFIG ${REPO_DIR}/binder/wasserstein_ipython_kernel_config.py > ./tmp_kernel_config.py
mv -v ./tmp_kernel_config.py $IPYTHON_KERNEL_CONFIG
